import pandas as pd
from matplotlib import pyplot as plt
import matplotlib

matplotlib.rc("font", family='Source Han Sans CN', weight="regular", size="10")

file_path = "csv/starbucks_store_worldwide.csv"
df = pd.read_csv(file_path)

china_starbucks = df[df["Country"] == "CN"].groupby(by="State/Province")
province_count = china_starbucks["Brand"].count().sort_values(ascending=False).head(20)

plt.xlabel("数量")
plt.ylabel("省份")
plt.title("星巴克中国各省门店数量统计图", weight="bold", size="16")
plt.yticks(range(len(province_count.index)), province_count.index)

plt.barh(range(len(province_count.index)), province_count.values, 0.5)
plt.show()
